<?php
/**
 * Created by PhpStorm.
 * User: 12133
 * Date: 2025/7/10
 * Time: 10:27
 */

namespace app\model;


use think\model\concern\SoftDelete;

class Goods extends Base
{
    use SoftDelete;
    public function nav(){
        return $this->hasOne(Nav::class,'id','nav_id');
    }
    public function content(){
        return $this->hasOne(InfoContent::class,'goods_id','id');
    }

    public function attr(){
        return $this->hasMany(Attr::class,'goods_id','id');
    }

    public function attrkey(){
        return $this->hasMany(AttrKey::class,'goods_id','id');
    }

    public function getStatusTextAttr($value,$data){
        if ($data['status'] == 1)
            return '上架';
        else
            return '下架';
    }
}